package com.ibeeking.found.upms.b.rest.controller.v1;

import com.ibeeking.found.upms.b.rest.service.IShopUserService;
import com.ibeeking.found.common.annotation.LoginUser;
import com.ibeeking.found.common.entity.CurrentUser;
import com.ibeeking.found.upms.service.common.query.ShopUserPageQuery;
import com.ibeeking.found.upms.service.common.vo.ShopUserPageVO;
import com.ibeeking.found.upms.service.common.vo.ShopUserVO;
import com.ibeeking.nematos.constants.enums.OperateLogTypeEnum;
import com.ibeeking.nematos.log.annotation.Log;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @ClassName ShopUserController控制器
 * @Description 商户用户管理
 * @Author ibeeking
 * @Date 2020-12-02 15:29
 **/
@RestController
@RequestMapping("/b/shopUser/v1")
public class ShopUserController {

    @Resource
    private IShopUserService shopUserServiceImpl;

    @Log(logType = OperateLogTypeEnum.QUERY, describe = "分页查询店铺员工列表")
    @PostMapping(value = "/pageList")
    public Page<ShopUserPageVO> pageList(@LoginUser CurrentUser currentUser, @RequestBody @Validated ShopUserPageQuery query) {
        return shopUserServiceImpl.pageList(currentUser.getTenantId(), query);
    }

    @Log(logType = OperateLogTypeEnum.QUERY, describe = "查询店铺员工")
    @GetMapping(value = "/view/{id}")
    public ShopUserVO view(@PathVariable("id") Long id) {
        return shopUserServiceImpl.view(id);
    }

}
